//
//  XLCardSwitch.h
//  XLCardSwitchDemo
//
//  Created by Apple on 2017/1/20.
//  Copyright © 2017年 Apple. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "XLCardItem.h"
#import "SINAStuHomeCoursItemModel.h"


typedef enum _CARD_SWITCH_PAGE_TYPE {
    CARDSERVICEPAGE  = 0,
    CARDMSGPAGE,
    CARDACTIVITYTARGET
} CARD_SWITCH_PAGE_TYPE;


typedef void(^XLCardSwitchItemClickBlock)(UIView *view,NSInteger index);

typedef void(^XLCardSwitchItemSwipeBlock)(UIView *view,NSInteger index);

@protocol XLCardSwitchDelegate <NSObject>

@optional

/**
 滚动代理方法
 */
-(void)XLCardSwitchDidSelectedAt:(NSInteger)index;

/**
 条目 view 点击代理方法
 */
-(void)XLCardItemSwitchDidSelectedAt:(NSInteger)index;

@end

@interface XLCardSwitch : UIView


/**
 当前选中位置
 */
@property (nonatomic, assign, readwrite) NSInteger selectedIndex;

@property(nonatomic,assign) BOOL isAnimation;
/**
 设置数据源
 */
@property (nonatomic, strong) NSArray <XLCardItem *>*items;
/**
 代理
 */
@property (nonatomic, weak) id<XLCardSwitchDelegate>delegate;

/**
 是否分页，默认为true
 */
@property (nonatomic, assign) BOOL pagingEnabled;
/**
 是否显示标题，默认为true
 */
@property (nonatomic, assign) BOOL showTitleEnabled;


@property(nonatomic,assign) CARD_SWITCH_PAGE_TYPE pagetype;


@property(nonatomic,strong) XLCardSwitchItemClickBlock  switchItemClickBlock;
@property(nonatomic,strong) XLCardSwitchItemSwipeBlock  switchItemSwipeBlock;

@property(nonatomic,strong) SINAStuHomeCoursItemModel *activityMmodel;
@property (nonatomic)NSMutableSet *timerSet;

/**
 手动滚动到某个卡片位置
 */
- (void)switchToIndex:(NSInteger)index animated:(BOOL)animated;

-(void)updateWithIndex:(NSInteger)updateIndex;



@end
